#include <fs.h>
#include <ds/lru.h>
#include <mm/slab.h>
#include <mm/valloc.h>

extern kmem_cache_t* sb_kmem_cache;
extern lru_t* dentry_lru, * inode_lru;

sb_t* fs_alloc_sb() {
    sb_t* sb = take_obj(sb_kmem_cache);
    memset(sb, 0, sizeof(*sb));

    list_head_init(&sb->sb_list);
    sb->inode_cache = vzalloc(FS_HASHTABLE_SIZE * sizeof(hbkt_t));
    return sb;
}

void fs_free_sb(sb_t* sb) {
    vfree(sb->inode_cache);
    release_obj(sb_kmem_cache, sb);
}